package com.wan37.protobuf;

import com.wan37.protobuf.analysis.ParseMap;
import com.wan37.protobuf.constant.PtoNum;
import com.wan37.protobuf.message.client2server.auth.Auth;
import com.wan37.protobuf.message.client2server.game.*;
import com.wan37.protobuf.message.internal.Internal;
import com.wan37.protobuf.message.othres.heartbeat.Heartbeat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 初始协议集合
 *
 * @author : luoyong
 * @date : 2020-05-27 11:03
 **/
public class ParseRegistryMap {
    private static final Logger logger = LoggerFactory.getLogger(ParseRegistryMap.class);

    public static void initRegistry() {

        logger.info("注册消息体的解析函数...");
        //internal(内部)
        ParseMap.register(PtoNum.GTRANSFER, Internal.GTransfer::parseFrom, Internal.GTransfer.class);
        ParseMap.register(PtoNum.GREET, Internal.Greet::parseFrom, Internal.Greet.class);
        ParseMap.register(PtoNum.GAMETOGATE, Internal.GameToGate::parseFrom, Internal.GameToGate.class);

        //auth
        ParseMap.register(PtoNum.CREGISTER, Auth.CRegister::parseFrom, Auth.CRegister.class);
        ParseMap.register(PtoNum.CLOGIN, Auth.CLogin::parseFrom, Auth.CLogin.class);
        ParseMap.register(PtoNum.SRESPONSE, Auth.SResponse::parseFrom, Auth.SResponse.class);

        //game
        ParseMap.register(PtoNum.CGAMEMSG, Game.CGameMsg::parseFrom, Game.CGameMsg.class);
        ParseMap.register(PtoNum.GAMESRESPONSE, Game.SResponse::parseFrom, Game.SResponse.class);
        ParseMap.register(PtoNum.CGAMEMOVE, Game.CGameMove::parseFrom, Game.CGameMove.class);
        ParseMap.register(PtoNum.CGAMEAOI, Game.CGameAoi::parseFrom, Game.CGameAoi.class);
        ParseMap.register(PtoNum.SGAMEAOIRESPONSE, Game.SGameAoiResponse::parseFrom, Game.SGameAoiResponse.class);
        ParseMap.register(PtoNum.CGAMECHATMSG, Game.CGameChatMsg::parseFrom, Game.CGameChatMsg.class);
        ParseMap.register(PtoNum.CGAMEATTACKMSG, Game.CGameAttack::parseFrom, Game.CGameAttack.class);
        ParseMap.register(PtoNum.SGAMEATTACKBROADCAST, Game.SGameAttackBroadcast::parseFrom, Game.SGameAttackBroadcast.class);
        ParseMap.register(PtoNum.CGAMESKILLMSG, Game.CGameSkillMsg::parseFrom, Game.CGameSkillMsg.class);
        ParseMap.register(PtoNum.SGAMESKILLRESPONSE, Game.SGameSkillResponse::parseFrom, Game.SGameSkillResponse.class);
        ParseMap.register(PtoNum.CGAMEROLEMSG, Game.CGameRoleMsg::parseFrom, Game.CGameRoleMsg.class);
        ParseMap.register(PtoNum.SGAMEROLERESPONSE, Game.SGameRoleResponse::parseFrom, Game.SGameRoleResponse.class);
        ParseMap.register(PtoNum.SGAMEATTACKRESPONSE, Game.SGameAttackResponse::parseFrom, Game.SGameAttackResponse.class);
        ParseMap.register(PtoNum.AOIBROADCASTRESPONSE, GameServerResponse.AoiBroadcastResponse::parseFrom, GameServerResponse.AoiBroadcastResponse.class);
        ParseMap.register(PtoNum.CGAMEWEAPONRYMSG, GameBackpack.CGameWeaponryMsg::parseFrom, GameBackpack.CGameWeaponryMsg.class);
        ParseMap.register(PtoNum.SWEAPONRYRESPONSE, GameBackpack.SWeaponryResponse::parseFrom, GameBackpack.SWeaponryResponse.class);
        ParseMap.register(PtoNum.CGAMEITEMMSG, GameBackpack.CGameItemMsg::parseFrom, GameBackpack.CGameItemMsg.class);
        ParseMap.register(PtoNum.SITEMRESPONSE, GameBackpack.SItemResponse::parseFrom, GameBackpack.SItemResponse.class);
        ParseMap.register(PtoNum.CGAMEUSERLOGININITMSG, Game.CGameUserLoginInitMsg::parseFrom, Game.CGameUserLoginInitMsg.class);
        ParseMap.register(PtoNum.GGAMEUSERLOGOUTMSG, Game.GGameUserLogoutMsg::parseFrom, Game.GGameUserLogoutMsg.class);
        ParseMap.register(PtoNum.CGAMEBOSSSCENEMSG, GameBossScene.CGameBossSceneMsg::parseFrom, GameBossScene.CGameBossSceneMsg.class);
        ParseMap.register(PtoNum.CGAMESHOPMEG, GameShop.CGameShopMsg::parseFrom, GameShop.CGameShopMsg.class);
        ParseMap.register(PtoNum.SSHOPRESPONSE, GameShop.SShopResponse::parseFrom, GameShop.SShopResponse.class);
        ParseMap.register(PtoNum.AOIROLEBROADCASTRESPONSE, GameServerResponse.AoiRoleBroadcastResponse::parseFrom, GameServerResponse.AoiRoleBroadcastResponse.class);
        ParseMap.register(PtoNum.ATTACKBROADCASTRESPONSE, GameFighting.AttackBroadcastResponse::parseFrom, GameFighting.AttackBroadcastResponse.class);
        ParseMap.register(PtoNum.AUTOFIGHTINGMSG, GameFighting.AutoFightingMsg::parseFrom, GameFighting.AutoFightingMsg.class);
        ParseMap.register(PtoNum.ONETOONECHAT, GameChat.OneToOneChat::parseFrom, GameChat.OneToOneChat.class);
        ParseMap.register(PtoNum.CHATRESPONSE, GameChat.ChatResponse::parseFrom, GameChat.ChatResponse.class);
        ParseMap.register(PtoNum.WORLDPLAYERCHAT, GameChat.WorldPlayerChat::parseFrom, GameChat.WorldPlayerChat.class);
        ParseMap.register(PtoNum.WORlDPLAYERCHATBROADCAST, GameChat.WorldPlayerChatBroadcast::parseFrom, GameChat.WorldPlayerChatBroadcast.class);
        ParseMap.register(PtoNum.ONETOONECHATOLD, GameChat.OneToOneChatOld::parseFrom, GameChat.OneToOneChatOld.class);
        ParseMap.register(PtoNum.WORLDPLAYERCHATOLD, GameChat.WorldPlayerChatOld::parseFrom, GameChat.WorldPlayerChatOld.class);
        ParseMap.register(PtoNum.USERIDTOWEAPONRY, GameBackpack.UserIdToWeaponry::parseFrom, GameBackpack.UserIdToWeaponry.class);
        ParseMap.register(PtoNum.SWEAPONRYBROADCASTRESPONSE, GameBackpack.SWeaponryBroadcastResponse::parseFrom, GameBackpack.SWeaponryBroadcastResponse.class);
        ParseMap.register(PtoNum.USEITEMBROADCASTRESPONSE, GameBackpack.UseItemBroadcastResponse::parseFrom, GameBackpack.UseItemBroadcastResponse.class);
        ParseMap.register(PtoNum.USERIDTOITEM, GameBackpack.UserIdToItem::parseFrom, GameBackpack.UserIdToItem.class);
        ParseMap.register(PtoNum.SKILLRESPONSEBROADCAST, Game.SkillResponseBroadcast::parseFrom, Game.SkillResponseBroadcast.class);
        ParseMap.register(PtoNum.CGAMECREATEROLEMSG, GameRole.CGameCreateRoleMsg::parseFrom, GameRole.CGameCreateRoleMsg.class);
        ParseMap.register(PtoNum.CGAMEWORLDPLAYEREMAILMSG, GameEmail.WorldPlayerEmailMsg::parseFrom, GameEmail.WorldPlayerEmailMsg.class);
        ParseMap.register(PtoNum.EMAILRESPONSE, GameEmail.EmailResponse::parseFrom, GameEmail.EmailResponse.class);
        ParseMap.register(PtoNum.EMAILBROADCAST, GameEmail.EmailBroadcast::parseFrom, GameEmail.EmailBroadcast.class);
        ParseMap.register(PtoNum.CGAMEPVPSCENEMSG, GameBossScene.CGamePvpSceneMsg::parseFrom, GameBossScene.CGamePvpSceneMsg.class);
        ParseMap.register(PtoNum.TEAMMSG, GameTeam.TeamMsg::parseFrom, GameTeam.TeamMsg.class);
        ParseMap.register(PtoNum.TEAMRESPONSE, GameTeam.TeamResponse::parseFrom, GameTeam.TeamResponse.class);
        ParseMap.register(PtoNum.TRADINGMSG, GameTrading.TradingMsg::parseFrom, GameTrading.TradingMsg.class);
        ParseMap.register(PtoNum.TRADINGRESPONSE, GameTrading.TradingResponse::parseFrom, GameTrading.TradingResponse.class);
        ParseMap.register(PtoNum.USER, GameEntity.User::parseFrom, GameEntity.User.class);
        ParseMap.register(PtoNum.GUILDMSG, GameGuild.GuildMsg::parseFrom, GameGuild.GuildMsg.class);
        ParseMap.register(PtoNum.GUILDRESPONSE, GameGuild.GuildResponse::parseFrom, GameGuild.GuildResponse.class);
        ParseMap.register(PtoNum.TRADINGSHOPMSG, GameTradingShop.TradingShopMsg::parseFrom, GameTradingShop.TradingShopMsg.class);
        ParseMap.register(PtoNum.TRADINGSHOPRESPONSE, GameTradingShop.TradingShopResponse::parseFrom, GameTradingShop.TradingShopResponse.class);
        ParseMap.register(PtoNum.TASKMSG, GameTask.TaskMsg::parseFrom, GameTask.TaskMsg.class);
        ParseMap.register(PtoNum.TASKRESPONSE, GameTask.TaskResponse::parseFrom, GameTask.TaskResponse.class);
        //心跳
        ParseMap.register(PtoNum.HEART, Heartbeat.Heart::parseFrom, Heartbeat.Heart.class);

        logger.info("消息体的解析函数注册完毕.");
    }


}
